
import 'package:baby/UI/Widgets/HtmlContent/TransformUnit.dart';
import 'package:flutter/material.dart';
import 'package:html/dom.dart' as prefix0;

import '../HtmlContent.dart';

class TagAudio extends TransformUnit<HtmlContentState, Object> {
  @override
  void execution(context, data) {
    if (data is prefix0.Element && data.localName == "audio"){
      var src = data.attributes["src"];
      if (src == null){
        var sourceElement = data.children.firstWhere((e) => e.localName == "source", orElse: null);
        if (sourceElement == null) return;
        src = sourceElement.attributes["src"];
        if (src == null) return;
      }
      pipeLineContext.processWith(Container(
        decoration: BoxDecoration(
          color: Color(0x08000000),
          borderRadius: BorderRadius.circular(15.0)
        ),
        padding: EdgeInsets.all(10.0),
        child: Row(
          children: <Widget>[
            IconButton(
              icon: Icon(Icons.volume_up),
              onPressed: (){},
            ),
            Expanded(
              child: Slider(onChanged: (value){}, value: 0.0, inactiveColor: context.widget.inactiveColor, activeColor: context.widget.activeColor,),
            ),
            Text("0:00 / 0:00"),
            IconButton(
              icon: Icon(Icons.play_arrow),
              onPressed: (){},
            )
          ],
        ),
      ));
    }
  }
}
